<ul class="posts">
    {% for post in posts %}
    <li class="post">
        <div class="post-thumbnail">
            <a href="{{ url_for('.user', username=post.author.username) }}">
                <img class="img-rounded profile-thumbnail" src="{{ post.author.gravatar(size=40) }}">
            </a>
        </div>
        <div class="post-content">
            <div class="post-date">{{ moment(post.timestamp).fromNow() }}</div>
            <div class="post-author">
                <a href="{{ url_for('.user', username=post.author.username) }}">{{ post.author.username }}</a>
            </div>
            {% if post.disabled  %}
                {% if current_user.is_administrator() or current_user.is_moderate(post.board) %}
                    <div class="post-body">
                        <p><i>该帖子已被删除</i></p>
                        <a href="{{ url_for('.post', id=post.id) }}" class="post-body">{{ post.title }}</a>
                    </div>
                    <div class="post-footer">
                        <a href="{{ url_for('.edit', id=post.id) }}">
                            <span class="label label-default">编辑 [Admin]</span>
                        </a>
                        <a href="{{ url_for('.recover_post', id=post.id) }}">
                            <span class="label label-success">恢复 [Admin]</span>
                        </a>
                        <a href="{{ url_for('.board', boardname=post.board.name) }}">
                            <span class="label label-info" >所属版块</span>
                        </a>
                        <a href="{{ url_for('.post', id=post.id) }}#comments">
                            <span class="label label-primary">{{ post.comment_count }} 条回帖</span>
                        </a>
                        <a href="{{ url_for('.post', id=post.id) }}#comments">
                            <span class="label label-primary">{{ post.view_count }} 阅读</span>
                        </a>
                    </div>

                {% else %}
                    <div class="post-body">
                        <p><i>该帖子已被删除</i></p>
                    </div>
                {% endif %}
            {% else %}
                <div class="post-body">
                    <a href="{{ url_for('.post', id=post.id) }}" class="post-body">{{ post.title }}</a>
                </div>
                <div class="post-footer">
                    {% if current_user.is_administrator() or current_user.is_moderate(post.board) %}
                    <a href="{{ url_for('.edit', id=post.id) }}">
                        <span class="label label-default">编辑[Admin]</span>
                    </a>
                    <a href="{{ url_for('.delete_post', id=post.id) }}">
                        <span class="label label-danger">删除[Admin]</span>
                    </a>
                    {% elif current_user == post.author %}
                    <a href="{{ url_for('.edit', id=post.id) }}">
                        <span class="label label-default">编辑</span>
                    </a>
                    <a href="{{ url_for('.delete_post', id=post.id) }}">
                        <span class="label label-danger">删除</span>
                    </a>
                    {% endif %}
                    <a href="{{ url_for('.board', boardname=post.board.name) }}">
                        <span class="label label-info" >所属版块</span>
                    </a>
                    <a href="{{ url_for('.post', id=post.id) }}#comments">
                        <span class="label label-primary">{{ post.comment_count }} 条回帖</span>
                    </a>
                    <a href="{{ url_for('.post', id=post.id) }}#comments">
                            <span class="label label-primary">{{ post.view_count }} 阅读</span>
                    </a>
                </div>
            {% endif %}

        </div>
    </li>
    {% endfor %}
</ul>